How to pass a string from Mainactivity.class to ContentProvider.class in Android











up vote
0
down vote

favorite












MainActivity.class



public static String data="Some text here";


ContentProvider.class



private synchronized void readContentFile(@NonNull Context context)

{

//I Need to get the String data here..

}


not able to use getIntent(); inside this class










share|improve this question
























  • String d = MainActivity.data;
    – Ty Kroll
    Nov 11 at 7:08










  • what do you want to achieve actually? whats your goal?
    – pskink
    Nov 11 at 7:49










  • it is returning as null
    – Hariharan Murugan
    Nov 11 at 11:20










  • @pskink i will have card view in main activity based on the selection of my card some text will be stored to String data then i will have to call this to content provider class but content provider class always returns null
    – Hariharan Murugan
    Nov 11 at 11:21












  • what Uri are you using? What do you need that content provider for?
    – pskink
    Nov 11 at 11:28















up vote
0
down vote

favorite












MainActivity.class



public static String data="Some text here";


ContentProvider.class



private synchronized void readContentFile(@NonNull Context context)

{

//I Need to get the String data here..

}


not able to use getIntent(); inside this class










share|improve this question
























  • String d = MainActivity.data;
    – Ty Kroll
    Nov 11 at 7:08










  • what do you want to achieve actually? whats your goal?
    – pskink
    Nov 11 at 7:49










  • it is returning as null
    – Hariharan Murugan
    Nov 11 at 11:20










  • @pskink i will have card view in main activity based on the selection of my card some text will be stored to String data then i will have to call this to content provider class but content provider class always returns null
    – Hariharan Murugan
    Nov 11 at 11:21












  • what Uri are you using? What do you need that content provider for?
    – pskink
    Nov 11 at 11:28













up vote
0
down vote

favorite









up vote
0
down vote

favorite











MainActivity.class



public static String data="Some text here";


ContentProvider.class



private synchronized void readContentFile(@NonNull Context context)

{

//I Need to get the String data here..

}


not able to use getIntent(); inside this class










share|improve this question















MainActivity.class



public static String data="Some text here";


ContentProvider.class



private synchronized void readContentFile(@NonNull Context context)

{

//I Need to get the String data here..

}


not able to use getIntent(); inside this class







javascript java android json






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 7:14









Sanchit Kumar

31117




31117










asked Nov 11 at 7:01









Hariharan Murugan

1




1












  • String d = MainActivity.data;
    – Ty Kroll
    Nov 11 at 7:08










  • what do you want to achieve actually? whats your goal?
    – pskink
    Nov 11 at 7:49










  • it is returning as null
    – Hariharan Murugan
    Nov 11 at 11:20










  • @pskink i will have card view in main activity based on the selection of my card some text will be stored to String data then i will have to call this to content provider class but content provider class always returns null
    – Hariharan Murugan
    Nov 11 at 11:21












  • what Uri are you using? What do you need that content provider for?
    – pskink
    Nov 11 at 11:28


















  • String d = MainActivity.data;
    – Ty Kroll
    Nov 11 at 7:08










  • what do you want to achieve actually? whats your goal?
    – pskink
    Nov 11 at 7:49










  • it is returning as null
    – Hariharan Murugan
    Nov 11 at 11:20










  • @pskink i will have card view in main activity based on the selection of my card some text will be stored to String data then i will have to call this to content provider class but content provider class always returns null
    – Hariharan Murugan
    Nov 11 at 11:21












  • what Uri are you using? What do you need that content provider for?
    – pskink
    Nov 11 at 11:28
















String d = MainActivity.data;
– Ty Kroll
Nov 11 at 7:08




String d = MainActivity.data;
– Ty Kroll
Nov 11 at 7:08












what do you want to achieve actually? whats your goal?
– pskink
Nov 11 at 7:49




what do you want to achieve actually? whats your goal?
– pskink
Nov 11 at 7:49












it is returning as null
– Hariharan Murugan
Nov 11 at 11:20




it is returning as null
– Hariharan Murugan
Nov 11 at 11:20












@pskink i will have card view in main activity based on the selection of my card some text will be stored to String data then i will have to call this to content provider class but content provider class always returns null
– Hariharan Murugan
Nov 11 at 11:21






@pskink i will have card view in main activity based on the selection of my card some text will be stored to String data then i will have to call this to content provider class but content provider class always returns null
– Hariharan Murugan
Nov 11 at 11:21














what Uri are you using? What do you need that content provider for?
– pskink
Nov 11 at 11:28




what Uri are you using? What do you need that content provider for?
– pskink
Nov 11 at 11:28

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246544%2fhow-to-pass-a-string-from-mainactivity-class-to-contentprovider-class-in-android%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246544%2fhow-to-pass-a-string-from-mainactivity-class-to-contentprovider-class-in-android%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python