۱۳۹۳/۱۱/۲۶, ۰۱:۰۹ ق.ظ
[font]ممنونم از لطف شما من سعی کردم ، اما متاسفانه نتونستم مشکلم رو بر طرف کنم ، کد ها ی برنامه رو میزارم ممنون میشم راهنمایی کنید ،چیکار باید بکنم
کلاس adapternote که گرید عناصر گرید ویو معرفی میشوند و ....[/font]
[font][i][/i][/font]کلاس G
activitymain که گرید ویو توش قرار داره و notifydatasetchange روش انجام می گیره
کلاس structnote که گریدویو ازش تغذیه میشه و عناصرشو در این کلاس تعریف کردم البته به نظر خودم imgcon رو به صورت یک لایه تعریف کنم بهتره میشه و به عبارتی وقتی رو لایه کلیک شد باید دوربین باز بشه و تصویر خروجی روی ایمیج ویوی مورد نظر که کلیک شده ست بشه ، ؟؟؟؟
ممنون میشم راهنمایی کنید ، که چطوری خروجی دوربین رو که به صورت بیت مپ هستش روی همون آیتم گرید ویو که ایمج ویو قرار دادم ست بشه ،؟؟؟
با سپاس فراوان از دوستان عزیز
کلاس adapternote که گرید عناصر گرید ویو معرفی میشوند و ....[/font]
[font][i][/i][/font]
کد پیاچپی:
public class AdapterNote extends ArrayAdapter<StructNote> {
public AdapterNote(ArrayList<StructNote> array) {
super(G.context, R.layout.adapter_note, array);
}
public static class ViewHolder {
public ViewGroup layoutimg;
public ViewGroup layoutdescription;
public TextView description;
public ImageView imgcontact;
public static Context context;
protected int TAKE_PICTURE;
public ImageView imgcon;
public ViewHolder(View view) {
//layoutimg = (ViewGroup)view.findViewById(R.id.layoutimg);
imgcon = ( ImageView)view.findViewById(R.id.imgcon);
}
public void fill(final ArrayAdapter<StructNote> adapter, final StructNote item, final int position) {
imgcon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
G.currentActivity.startActivityForResult(intent, TAKE_PICTURE);
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == TAKE_PICTURE) {
{
// Uri selectedImage = data.getData();
// String[] filePathColumn = { MediaStore.Images.Media.DATA };
//
// getContentResolver();
// Cursor cursor = Media.query(null, selectedImage,
// filePathColumn, null, null, null);
// cursor.moveToFirst();
//int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
// String picturePath = cursor.getString(columnIndex);
//cursor.close();
//ImageView imageView = (ImageView) findViewById(R.id.imgView);
// imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath))
// ImageView imgcon = (ImageView) findViewById(R.id.imgcon);
// Bitmap photo = (Bitmap) data.getExtras().get("data");
// imgcon.setImageBitmap(photo);
// Log.i("LOG", "return from camera");
}
}
layoutdescription.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(G.currentActivity, ActivtySmsBody.class);
G.currentActivity.startActivity(intent);
}
});
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
StructNote item = getItem(position);
if (convertView == null) {
convertView = G.inflater.inflate(R.layout.adapter_note, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.fill(this, item, position);
return convertView;
}
}
کد پیاچپی:
public class G extends Application {
public class context {
}
public static LayoutInflater inflater;
public static SharedPreferences preferences;
public static String defaultBackground;
public static String animation;
public static Activity currentActivity;
public static ArrayList<StructNote> notes = new ArrayList<StructNote>();
public static String DIR_APP = Environment.getExternalStorageDirectory().getAbsolutePath() + "/cameraCapture";
public static Context context;
public static int Itemimge;
@Override
public void onCreate() {
super.onCreate();
context = getApplicationContext();
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
preferences = PreferenceManager.getDefaultSharedPreferences(context);
defaultBackground = preferences.getString("default_background", "theme00");
animation = preferences.getString("default_animation", "anim00");
new File(DIR_APP).mkdirs();
}
}
کد پیاچپی:
public class IconImage extends Activity {
public ArrayAdapter adapter;
@Override
protected void onResume() {
G.currentActivity = this;
super.onResume();
if (adapter != null) {
adapter.notifyDataSetChanged();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.icon_image);
final GridView gridv = (GridView) findViewById(R.id.gridv);
adapter = new AdapterNote(G.notes);
gridv.setAdapter(adapter);
for (int i = 0; i < 102; i++) {
StructNote note = new StructNote();
note.description = "Textviw " + i;
note.ImageView = "image_res_ID" != null ;
G.notes.add(note);
}
adapter.notifyDataSetChanged();
}
}
کد پیاچپی:
public class StructNote {
public String description;
public Bitmap imgcontact;
public Bitmap imgcon;
public int position;
public Bitmap lstContent;
public boolean ImageView;
public int textView;
public int ResourceId;
}
ممنون میشم راهنمایی کنید ، که چطوری خروجی دوربین رو که به صورت بیت مپ هستش روی همون آیتم گرید ویو که ایمج ویو قرار دادم ست بشه ،؟؟؟
با سپاس فراوان از دوستان عزیز